import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Piso here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Piso extends Ladrillo
{

    private Ladrillo []arregloLadrillo;

    public Piso()
    {
        arregloLadrillo= new Ladrillo[300];
        for(int i=0;i<300;i++)
        {
            arregloLadrillo[i]=new Ladrillo();  
        }
    }

    /**
     * Act - do whatever the Piso wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
        // Add your action code here.
    }    

    protected void addedToWorld(World world)
    {
        int ii=0;
        int i;
        //piso1
        for(i=0;i<60;i++)
        {
            world.addObject(arregloLadrillo[i],getX()+ii,getY());
            ii+=15;
        }
        //piso2
        ii=105;
        
        for(i=60;i<106;i++)
        {
            world.addObject(arregloLadrillo[i],getX()+ii,getY()-75);
            ii+=15;
        }
        //piso3
        ii=165;
        for(i=106;i<144;i++)
        {
            world.addObject(arregloLadrillo[i],getX()+ii,getY()-150);
            ii+=15;
        }
        //piso4
        ii=165;
        for(i=144;i<182;i++)
        {
            world.addObject(arregloLadrillo[i],getX()+ii,getY()-300);
            ii+=15;
        }
        //piso5
        ii=165;
        for(i=182;i<220;i++)
        {
            world.addObject(arregloLadrillo[i],getX()+ii,getY()-450);
            ii+=15;
        }
    }
}
